<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>readmps</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : MAY 1998</div>
    <p>
      <b>readmps</b> -  reads a file in MPS format</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt> mps= readmps (file-name,bounds [,maxsizes]);   </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>file-name</b>
        </tt>:
    character string, path of the MPS file</li>
      <li>
        <tt>
          <b>bounds</b>
        </tt>: 2-vector
    <tt>
          <b>[lowbound,upbound]</b>
        </tt> , default lower ans upper bounds</li>
      <li>
        <tt>
          <b>maxsizes</b>
        </tt>: 3-vector <tt>
          <b>[maxm,maxn,maxnza]</b>
        </tt>
  Maximum number of contraints and variables, maximum number of
  nonzeros entries in the LP constraint matrix. If omitted readmps
  reads the file once just to compute these numbers.</li>
      <li>
        <tt>
          <b>mps</b>
        </tt>: tlist with following fields<ul>
          <li>
            <tt>
              <b>irobj</b>
            </tt>: integer (index of the objective row).</li>
          <li>
            <tt>
              <b>namec</b>
            </tt>: character string (Name of the objective).</li>
          <li>
            <tt>
              <b>nameb</b>
            </tt>: character string (Name of the right hand side).</li>
          <li>
            <tt>
              <b>namran</b>
            </tt>: character string (Name of the ranges section).</li>
          <li>
            <tt>
              <b>nambnd</b>
            </tt>: character string (Name of the bounds section).</li>
          <li>
            <tt>
              <b>name</b>
            </tt>: character string (Name of the  LP problem).</li>
          <li>
            <tt>
              <b>rownames</b>
            </tt>: character string column vector (Name of the rows). 
          colnames : character string row vector (Name of the columns).</li>
          <li>
            <tt>
              <b>rowstat</b>
            </tt>: integer vector,  row types:<ul>
              <li>
                <tt>
                  <b>1</b>
                </tt>row type is "="</li>
              <li>
                <tt>
                  <b>2</b>
                </tt>:  row type is "&gt;="</li>
              <li>
                <tt>
                  <b>3</b>
                </tt>:  row type is "&lt;="</li>
              <li>
                <tt>
                  <b>4</b>
                </tt>:  objective row</li>
              <li>
                <tt>
                  <b>5</b>
                </tt>:  other free row</li>
            </ul>
          </li>
          <li>
            <tt>
              <b>rowcode</b>
            </tt>: real matrix <tt>
              <b>[hdrowcd,lnkrow]</b>
            </tt> with<ul>
              <li>
                <tt>
                  <b>hdrowcd</b>
                </tt>: real vector (Header to the linked list of rows with the same codes).</li>
              <li>
                <tt>
                  <b>lnkrow</b>
                </tt>: integer vector (Linked list of rows with the same codes).</li>
            </ul>
          </li>
          <li>
            <tt>
              <b>colcode</b>
            </tt>: real matrix <tt>
              <b>[hdcolcd,lnkcol]</b>
            </tt> with<ul>
              <li>
                <tt>
                  <b>hdcolcd</b>
                </tt>: integer vector (Header to the linked list of columns with the same codes).</li>
              <li>
                <tt>
                  <b>lnkcol</b>
                </tt>: integer vector (Linked list of columns with the same codes).</li>
            </ul>
          </li>
          <li>
            <tt>
              <b>rownmbs</b>
            </tt>: integer vector (Row numbers of nonzeros in columns of matrix A.)</li>
          <li>
            <tt>
              <b>colpnts</b>
            </tt>: integer vector (Pointers to the beginning of columns of matrix A).</li>
          <li>
            <tt>
              <b>acoeff</b>
            </tt>: real vector (Array of nonzero elements for each column).</li>
          <li>
            <tt>
              <b>rhs</b>
            </tt>:real vector ( Right hand side of the linear program).</li>
          <li>
            <tt>
              <b>ranges</b>
            </tt>: real vector of constraint ranges.</li>
          <li>
            <tt>
              <b>bounds</b>
            </tt>: real matrix <tt>
              <b>[lbounds,ubounds]</b>
            </tt> with<ul>
              <li>
                <tt>
                  <b>ubounds</b>
                </tt>: full column vector of upper bounds</li>
              <li>
                <tt>
                  <b>lbounds</b>
                </tt>: full column vector of lower bounds</li>
            </ul>
          </li>
          <li>
            <tt>
              <b>stavar</b>
            </tt>: full column vector of variable status<ul>
              <li>
                <tt>
                  <b>0</b>
                </tt>:standard (non negative) variable</li>
              <li>
                <tt>
                  <b>1</b>
                </tt>: upper bounded variable</li>
              <li>
                <tt>
                  <b>2</b>
                </tt>: lower bounded variable</li>
              <li>
                <tt>
                  <b>3</b>
                </tt>: lower and upper bounded variable</li>
              <li>
                <tt>
                  <b>4</b>
                </tt>: minus infinity type variable  i.e -inf&lt;x&lt;=u</li>
              <li>
                <tt>
                  <b>5</b>
                </tt>: plus infinity type variable  i.e l&lt;=x&lt; inf</li>
              <li>
                <tt>
                  <b>6</b>
                </tt>: fixed type variable  i.e l=x=u</li>
              <li>
                <tt>
                  <b>-k</b>
                </tt>: free variable</li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
      <tt>
        <b>readmps</b>
      </tt>.
    Utility function: reads a file containing description of an LP problem
    given  in MPS format. It is an
    interface with the program <tt>
        <b>rdmps1.f</b>
      </tt> of hopdm (J. Gondzio).
    For a description of the variables, see the file rdmps1.f.</p>
    <p>
    MPS format is a standard ASCII medium for LP codes.  
    MPS format is described in more detail in Murtagh's book:</p>
    <p>
    Murtagh B. (1981). Advanced Linear Programming, McGrew-Hill,
    New York, 1981.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>


//Let the LP problem:
//objective:
//   min     XONE + 4 YTWO + 9 ZTHREE
//constraints:
//  LIM1:    XONE +   YTWO            &lt; = 5
//  LIM2:    XONE +            ZTHREE &gt; = 10
// MYEQN:         -   YTWO  +  ZTHREE   = 7
//Bounds
//  0 &lt; = XONE &lt; = 4
// -1 &lt; = YTWO &lt; = 1

//Generate MPS file 
txt=['NAME          TESTPROB'
     'ROWS'
     ' N  COST'
     ' L  LIM1'
     ' G  LIM2'
     ' E  MYEQN'
     'COLUMNS'
     '    XONE      COST                 1   LIM1                 1'
     '    XONE      LIM2                 1'
     '    YTWO      COST                 4   LIM1                 1'
     '    YTWO      MYEQN               -1'
     '    ZTHREE    COST                 9   LIM2                 1'
     '    ZTHREE    MYEQN                1'
     'RHS'
     '    RHS1      LIM1                 5   LIM2                10'
     '    RHS1      MYEQN                7'
     'BOUNDS'
     ' UP BND1      XONE                 4'
     ' LO BND1      YTWO                -1'
     ' UP BND1      YTWO                 1'
     'ENDATA'];
mputl(txt,TMPDIR+'/test.mps')
//Read the MPS file
P=readmps(TMPDIR+'/test.mps',[0 10^30])
//Convert it to linpro format
LP=mps2linpro(P)
//Solve it with linpro
[x,lagr,f]=linpro(LP(2:$))
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="../elementary/mps2linpro.htm">
        <tt>
          <b>mps2linpro</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
